package com.hexiang.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.remoting.caucho.HessianServiceExporter;
import org.springframework.stereotype.Controller;

import com.hexiang.service.HelloWorldService;

@Controller
public class HessianController {

    @Autowired
    private HelloWorldService helloWorldService;

    //发布服务 （此处定义外部访问路径，比如本例中，对外提供的API 为 http://127.0.0.1:8080/oaframe/HelloWorldService）
    @Bean(name = "/HelloWorldService")
    public HessianServiceExporter accountService() {
        HessianServiceExporter exporter = new HessianServiceExporter();
        exporter.setService(helloWorldService);
        exporter.setServiceInterface(HelloWorldService.class);
        return exporter;
    }
}